class Subscription {
     constructor() {
      this.subscribers = new Map([['any', []]]);
     }

     static instance()
     {
         if(!Subscription._instance)
         {
             Subscription._instance = new Subscription();
         }
         return Subscription._instance;
     }

    on(fn, type = 'any') {
      let subs = this.subscribers;
      if (!subs.get(type)) {
        return subs.set(type, [fn]);
      }
      subs.set(type, (subs.get(type).push(fn)));
     }

     emit(content, type = 'any') {
      for (let fn of this.subscribers.get(type)) {
        fn(content);
      }
    }
}



Subscription.instance().on((content) => alert(`Congratulations for you! ${content}，:We are pleased to inform you that you have won the first prize in this issue.`), 'myEvent');
Subscription.instance().emit('fong', 'myEvent'); //get published content: jaja
